package com.post.subscribe;

import java.lang.reflect.Method;

public class Subscirber {
	public Object object;
	public Method method;
	int threadType = Poster.ThreadType_CURRENT;
	//the key is a class  of parameter in method , for call the method quickly.
	public Class<?> classParameter;
	
	public Subscirber(Object object, Method postMethed) {
		Class<?>[]  parameters = postMethed.getParameterTypes();
		if (parameters==null||parameters.length!=1) {
			throw new IllegalArgumentException("parameters==null||parameters.length!=1");
		}
		
		this.object = object;
		this.method = postMethed;
		this.classParameter = parameters[0];
		
		if (postMethed.getName().startsWith(Poster.DEFAULT_METHOD_NAME_IN_MAIN)) {
			this.threadType = Poster.ThreadType_MAIN;
		}else if(postMethed.getName().startsWith(Poster.DEFAULT_METHOD_NAME_IN_GL)){
			this.threadType = Poster.ThreadType_GL;
		}
	}

	
}
